return ret;
}
-GVariant *
-ostree_get_xattrs_for_file (GFile *f,
- GError **error)
+gboolean
+ostree_get_xattrs_for_file (GFile *f,
+ GVariant **out_xattrs,
+ GCancellable *cancellable,
+ GError **error)
{
+ gboolean ret = FALSE;
const char *path;
- GVariant *ret = NULL;
+ GVariant *ret_xattrs = NULL;
GVariantBuilder builder;
+ gboolean builder_initialized = FALSE;
char *xattr_names = NULL;
char *xattr_names_canonical = NULL;
ssize_t bytes_read;
path = ot_gfile_get_path_cached (f);
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ayay)"));
+ builder_initialized = TRUE;
bytes_read = llistxattr (path, NULL, 0);
goto out;
}
- ret = g_variant_builder_end (&builder);
- g_variant_ref_sink (ret);
+ ret_xattrs = g_variant_builder_end (&builder);
+ g_variant_ref_sink (ret_xattrs);
+
+ ret = TRUE;
+ ot_transfer_out_value (out_xattrs, &ret_xattrs);
out:
- if (!ret)
+ if (!builder_initialized)
g_variant_builder_clear (&builder);
g_free (xattr_names);
g_free (xattr_names_canonical);
if (objtype == OSTREE_OBJECT_TYPE_RAW_FILE)
{
- xattrs = ostree_get_xattrs_for_file (f, error);
- if (!xattrs)
+ if (!ostree_get_xattrs_for_file (f, &xattrs, cancellable, error))
goto out;
}
char *ostree_get_relative_object_path (const char *checksum,
OstreeObjectType type);
-GVariant *ostree_get_xattrs_for_file (GFile *f,
- GError **error);
+gboolean ostree_get_xattrs_for_file (GFile *f,
+ GVariant **out_xattrs,
+ GCancellable *cancellable,
+ GError **error);
GVariant *ostree_wrap_metadata_variant (OstreeObjectType type, GVariant *metadata);
else
{
local_file = ostree_repo_file_nontree_get_local (self);
- ret_xattrs = ostree_get_xattrs_for_file (local_file, error);
+ if (!ostree_get_xattrs_for_file (local_file, &ret_xattrs, cancellable, error))
+ goto out;
}
ret = TRUE;
{
if (!(modifier && modifier->skip_xattrs))
{
- xattrs = ostree_get_xattrs_for_file (dir, error);
- if (!xattrs)
+ if (!ostree_get_xattrs_for_file (dir, &xattrs, cancellable, error))
goto out;
}
if (!(modifier && modifier->skip_xattrs))
{
- xattrs = ostree_get_xattrs_for_file (child, error);
- if (!xattrs)
+ if (!ostree_get_xattrs_for_file (child, &xattrs, cancellable, error))
goto out;
}
}
if (out_xattrs)
{
- ret_xattrs = ostree_get_xattrs_for_file (content_loose_path, error);
- if (!ret_xattrs)
+ if (!ostree_get_xattrs_for_file (content_loose_path, &ret_xattrs, cancellable,error))
goto out;
}
}
goto out;
if (objtype == OSTREE_OBJECT_TYPE_RAW_FILE)
- xattrs = ostree_get_xattrs_for_file (objfile, error);
+ {
+ if (!ostree_get_xattrs_for_file (objfile, &xattrs, cancellable, error))
+ goto out;
+ }
if (objtype == OSTREE_OBJECT_TYPE_ARCHIVED_FILE_CONTENT)
;